import service from "../index.js";
import qs from "qs";

const categoryApi = {
    //添加分类
    insert(category){
        return service.post('/admin/category',category);
    },
    //根据id删除
    delete(id){
        return service.delete(`/admin/category/${id}`)
    },
    //修改
    update(category){
        return service.put('/admin/category',category);
    },
    //查询所有
    selectByPage(pageNum, pageSize, category){
        category.pageNum = pageNum;
        category.pageSize = pageSize;

        //请求参数
        return service.get('/admin/category', {params: category});
    },
    //根据id查询
    selectByID(id){
        return service.get(`/admin/category/${id}`)
    },
}
export default categoryApi;